<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="../css/docs.css" type="text/css" rel="stylesheet" />
<link href="../css/prettify.css" type="text/css" rel="stylesheet" />
<script src="../js/prettify.js" type="text/javascript"></script>
</head>
<body onLoad="prettyPrint()">
<div class="g-unit" id="doc-content">
<div id="api-info-block">
<div class="api-level">H3C CAS云管理平台</div>
</div>
<div id="jd-header">
<h1>增加ACL策略</h1>
</div>
<div id="jd-content">
<div class="jd-descr">
<p>增加ACL策略。</p>
<h2><a name="uri"></a>接口 URI</h2>
<p>/cas/casrs/acl</p>
<h2><a name="access"></a>访问方法</h2>
<dl>
  <dt><b>HTTP 方法</b></dt>
  <dd>POST</dd>
  <dt><b>消息体</b></dt>
  <div class="source">
    <pre class="prettyprint lang-xml">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;aclStrategy&gt;<br>  &lt;name&gt;example-acl&lt;/name&gt;<br>  &lt;description&gt;示例acl&lt;/description&gt;<br>  &lt;defaultAclAction&gt;1&lt;/defaultAclAction&gt;<br>  &lt;defaultAclOutAction&gt;1&lt;/defaultAclOutAction&gt;<br>  &lt;rule&gt;<br>    &lt;protocol&gt;17&lt;/protocol&gt;<br>    &lt;srcIp&gt;192.168.10.0&lt;/srcIp&gt;<br>    &lt;srcMask&gt;255.255.255.0&lt;/srcMask&gt;<br>    &lt;srcPort&gt;80&lt;/srcPort&gt;<br>    &lt;destIp&gt;192.168.20.0&lt;/destIp&gt;<br>    &lt;destMask&gt;255.255.255.0&lt;/destMask&gt;<br>    &lt;destPort&gt;2336&lt;/destPort&gt;<br>    &lt;action&gt;1&lt;/action&gt;<br>    &lt;priority&gt;1&lt;/priority&gt;<br>    &lt;direction&gt;1&lt;/direction&gt;<br>  &lt;/rule&gt;<br>  &lt;type&gt;3&lt;/type&gt;<br>  &lt;timeRangeEnabled&gt;0&lt;/timeRangeEnabled&gt;<br>&lt;/aclStrategy&gt;<br><br></pre>
  </div>
</dl>
<h2><a name="result"></a>返回结果</h2>
<dl>
  <dt><b>状态码</b></dt>
  <dd>
  <ul>
    <li>204(No Content)：成功。</li>
  </ul>
  </dd>
  <dt><b>消息头</b></dt>
  <br>
  <pre class="prettyprint lang-xml">
HTTP/1.1 204 No Content
</pre>
  
</dl>
<dt><a name="detail"></a><b>元素含义</b></dt>
<table class="jd-sumtable" id="pubmethods">
  <tbody>
    <tr>
      <th colspan="2"><span class="prettyprint lang-xml">aclStrategy</span>各子元素</th>
    <tr>
      <td class="jd-typecol"><span class="prettyprint lang-xml">name</span></td>
      <td class="jd-linkcol" width="100%"><span class="sympad">ACL策略名。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
    </tr>
    <tr class="alt-color">
      <td class="jd-typecol"><span class="prettyprint lang-xml">description</span></td>
      <td class="jd-linkcol"><span class="sympad">ACL策略描述。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
    </tr>
    <tr>
      <td class="jd-typecol"><span class="prettyprint lang-xml">defaultAclAction</span></td>
      <td class="jd-linkcol"><span class="sympad">入方向默认动作  (0:拒绝;1:允许)。</span>
          <div class="jd-descrdiv">整数（Integer）类型。</div></td>
    </tr>
	<tr class="alt-color">
      <td class="jd-typecol"><span class="prettyprint lang-xml">defaultAclOutAction</span></td>
      <td class="jd-linkcol"><span class="sympad">出方向默认动作  (0:拒绝;1:允许)。</span>
          <div class="jd-descrdiv">整数（Integer）类型。</div></td>
    </tr>
    <tr>
      <td class="jd-typecol"><span class="prettyprint lang-xml">type</span></td>
      <td class="jd-linkcol" width="100%"><span class="sympad">ACL类型，3：IPV4，2：二层ACL（基于MAC）。</span>
          <div class="jd-descrdiv">整数（Integer）类型。</div></td>
    </tr>
	<tr class="alt-color">
      <td class="jd-typecol"><span class="prettyprint lang-xml">timeRangeEnabled</span></td>
      <td class="jd-linkcol" width="100%"><span class="sympad">启用时间段，1启用，即ACL只在指定时间内生效，0，不启用。</span>
          <div class="jd-descrdiv">整数（Integer）类型。</div></td>
    </tr>
	<tr>
      <td class="jd-typecol"><span class="prettyprint lang-xml">effectTimeRange</span></td>
      <td class="jd-linkcol" width="100%"><span class="sympad">ACL生效时间段，多个时间段以逗号分隔，时间段格式为"0-3,5-5,8-12"</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
    </tr>
	<tr class="alt-color">
      <td class="jd-typecol"><span class="prettyprint lang-xml">createTime</span></td>
      <td class="jd-linkcol" width="100%"><span class="sympad">ACL策略创建时间。</span>
          <div class="jd-descrdiv">时间（Date）类型。</div></td>
    </tr>
</table><p/>
<table class="jd-sumtable" id="pubmethods">
  <tbody>
    <tr>
      <th colspan="2"><span class="prettyprint lang-xml">rule</span>各子元素</th>
     <tr>
      <td class="jd-typecol"><span class="prettyprint lang-xml">protocol</span></td>
      <td class="jd-linkcol" width="100%"><span class="sympad"> ACL规则协议号码, ICMP为1,TCP为6,UDP为17，所有协议为65535。</span>
          <div class="jd-descrdiv">整数（int）类型。</div></td>
    </tr>
    <tr class="alt-color">
      <td class="jd-typecol"><span class="prettyprint lang-xml">srcIp</span></td>
      <td class="jd-linkcol"><span class="sympad">源IP地址。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
    </tr>
    <tr>
      <td class="jd-typecol"><span class="prettyprint lang-xml">srcMask</span></td>
      <td class="jd-linkcol"><span class="sympad">源子网掩码。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
    </tr>
	<tr class="alt-color">
      <td class="jd-typecol"><span class="prettyprint lang-xml">srcPort</span></td>
      <td class="jd-linkcol"><span class="sympad">源端口。</span>
          <div class="jd-descrdiv">整数（Integer）类型。</div></td>
    </tr>
	<tr>
      <td class="jd-typecol"><span class="prettyprint lang-xml">destIp</span></td>
      <td class="jd-linkcol"><span class="sympad">目的IP地址。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
    </tr>
    <tr class="alt-color">
      <td class="jd-typecol"><span class="prettyprint lang-xml">destMask</span></td>
      <td class="jd-linkcol"><span class="sympad">目的子网掩码。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
    </tr>
	<tr>
      <td class="jd-typecol"><span class="prettyprint lang-xml">destPort</span></td>
      <td class="jd-linkcol"><span class="sympad">目的端口。</span>
          <div class="jd-descrdiv">整型（Integer）类型。</div></td>
    </tr>
    <tr class="alt-color">
      <td class="jd-typecol"><span class="prettyprint lang-xml">action</span></td>
      <td class="jd-linkcol" width="100%"><span class="sympad">ACL规则对报文采取的动作(0:拒绝;1:允许)</span><span class="sympad">。</span>
          <div class="jd-descrdiv">整数（int）类型。</div></td>
    </tr>
	 <tr>
      <td class="jd-typecol"><span class="prettyprint lang-xml">priority</span></td>
      <td class="jd-linkcol" width="100%"><span class="sympad">优先级。</span>
          <div class="jd-descrdiv">整数（int）类型。</div></td>
    </tr>
</table>
<h2><a name="example"></a>应用举例</h2>
    <p>增加ACL策略。</p>
    <dl>
      <dt><b>请求</b></dt>
      <div class="source">
        <pre class="prettyprint lang-xml">POST http://192.168.10.3:8080/cas/casrs/acl
accept: application/xml
...
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;aclStrategy&gt;<br>  &lt;name&gt;example-acl&lt;/name&gt;<br>  &lt;description&gt;示例acl&lt;/description&gt;<br>  &lt;defaultAclAction&gt;1&lt;/defaultAclAction&gt;<br>  &lt;defaultAclOutAction&gt;1&lt;/defaultAclOutAction&gt;<br>  &lt;rule&gt;<br>    &lt;protocol&gt;17&lt;/protocol&gt;<br>    &lt;srcIp&gt;192.168.10.0&lt;/srcIp&gt;<br>    &lt;srcMask&gt;255.255.255.0&lt;/srcMask&gt;<br>    &lt;srcPort&gt;80&lt;/srcPort&gt;<br>    &lt;destIp&gt;192.168.20.0&lt;/destIp&gt;<br>    &lt;destMask&gt;255.255.255.0&lt;/destMask&gt;<br>    &lt;destPort&gt;2336&lt;/destPort&gt;<br>    &lt;action&gt;1&lt;/action&gt;<br>    &lt;priority&gt;1&lt;/priority&gt;<br>    &lt;direction&gt;1&lt;/direction&gt;<br>  &lt;/rule&gt;<br>  &lt;type&gt;3&lt;/type&gt;<br>  &lt;timeRangeEnabled&gt;0&lt;/timeRangeEnabled&gt;<br>&lt;/aclStrategy&gt;</pre>
      </div>
      <dt><b>回应</b></dt>
      <div class="source"><pre class="prettyprint lang-xml">
HTTP/1.1 204 No Content
Content-Type: application/xml<br>....<br></pre>
      </div>
    </dl>
</div>
</div>
</div>
</body>
</html>